import Vue from 'vue'
import Router from 'vue-router'
// 导入刚才编写的组件
import AppIndex from '@/components/home/AppIndex'
import Login from '@/components/Login'
import Home from '@/components/Home'


Vue.use(Router)

export default new Router({
  mode:'history',
  routes: [
	  {
	    path: '/',
	    name: 'Default',
	    redirect: '/login',
	    component: Login
	  },
       {
        path: '/home',
        name: 'Home',
        component: Home,
        // home页面并不需要被访问
        redirect: '/index',
        children: [
          {
            path: '/index',
            name: 'AppIndex',
            component: AppIndex,
            meta: {
              requireAuth: true
            }
          }
        ]
      },
      {
        path: '/login',
        name: 'Login',
        component: Login
      },
      {
        path: '/register',
        name: 'Register',
        component: () => import('../components/Register')
      }
    ]
  })
